﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Net.Mail;

namespace InternshipManagement.Helpers
{
    public class EmailSender
    {
        public static bool sendMail(string To,string Header,string Body)
        {
            try
            {
                MailMessage mmessage = new MailMessage("CTIS IMS <ctisimsproject@gmail.com>", To, Header, Body);
                SmtpClient emailClient = new SmtpClient("smtp.gmail.com");
                System.Net.NetworkCredential SMTPUserInfo = new System.Net.NetworkCredential("ctisimsproject@gmail.com", "ct112233");
                emailClient.UseDefaultCredentials = false;
                emailClient.Port = 587;
                emailClient.EnableSsl = true;
                emailClient.Credentials = SMTPUserInfo;
                emailClient.Send(mmessage);
                return true;
            }
            catch{
                return false;
            }
        }
    }
}